1. Field of the Invention
The present invention relates generally to computer software. More particularly, the present invention relates to methods and apparatus for providing a mechanism for use in aiding stack unwinding.
2. Description of the Related Art
A conventional software process from the compilation through the debugging process is illustrated in FIG. 1. As shown at block 102, source code is received by a compiler 102. The compiler 102 processes statements written in a particular programming language. The compiler 102 may either produce machine-readable code (e.g., object code) or assembly code for input to an assembler 104. Of course, it is possible for a human to generate assembly code directly without the assistance of a compiler.
When the assembler 104 receives the assembly code, it converts the assembly code into object code. One or more object code files may then linked by a linker 107 to generate an executable file 108. The executable file 108 may then be loaded into memory and run, or the executable file 108 may be debugged using a debugger 106. For instance, a debugger may enable a computer programmer to step through the object code or perform “call tracing.” When the object code is ultimately executed, an exception handler 108 may be called during execution of the object code when an exception trap occurs.
During execution of the object code, a run time stack is used to store data for the called functions. More particularly, a stack is a push-down list. In other words, when a new function is called, data for that function are pushed onto the stack, pushing down the stack entries. Conversely, when a program accesses an item from a stack, the program always takes its next item to handle from the top of the stack. Thus, function data are pushed onto the stack, and popped from the stack as necessary.
In order to perform various processes, such as debugging (e.g., call tracing) and exception handling, the stack must be at least partially “unwound.” In other words, data of a previous function in the call chain on the stack may need to be recalled. For example, exception handling or call tracing (e.g., back tracing) must perform some stack unwinding to access data that were previously pushed onto the stack.
In view of the above, there is a need to devise methods and apparatus for providing a human readable mechanism for enabling easy access to the pushed function data during stack unwinding.